﻿using SqlMapper.SqlElements;
using System.Collections.Specialized;
using System.Xml;

namespace SqlMapper.Serializers
{
    /// <summary>
	/// Summary description for IsEmptyDeSerializer.
	/// </summary>
	public sealed class IsEmptyDeSerializer : IDeSerializer
    {
        /// <summary>
        /// Deserialize a IsNotNull object
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public BaseTag Deserialize(XmlNode node)
        {
            IsEmpty isEmpty = new IsEmpty();

            NameValueCollection prop = NodeUtils.ParseAttributes(node);
            isEmpty.Prepend = NodeUtils.GetStringAttribute(prop, "prepend");
            isEmpty.Property = NodeUtils.GetStringAttribute(prop, "property");
            isEmpty.Sql = NodeUtils.GetStringAttribute(prop, "sql");

            return isEmpty;
        }
    }
}
